<html>
<head><meta charset="utf-8"><title>unused timestamps · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html">unused timestamps</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="159063174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159063174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159063174">(Feb 21 2019 at 12:27)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> what are unused time stamps for? When one pushes something off the stack, then that time-stamp becomes "unused" I guess</p>



<a name="159063187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159063187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159063187">(Feb 21 2019 at 12:27)</a>:</h4>
<p>but why does <code>Tracking</code> need to keep track of the next unused one ?</p>



<a name="159069452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159069452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159069452">(Feb 21 2019 at 14:02)</a>:</h4>
<p>it's just a monotonically increasing counter</p>



<a name="159069458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159069458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159069458">(Feb 21 2019 at 14:02)</a>:</h4>
<p>and the next not-yet-used (as in handed out) timestamp must be stored somewhere</p>



<a name="159069459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159069459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159069459">(Feb 21 2019 at 14:02)</a>:</h4>
<p>nothing complicated^^</p>



<a name="159069502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159069502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159069502">(Feb 21 2019 at 14:03)</a>:</h4>
<p>I must be doing something wrong if I invoke complicated thoughts involving garbage collection of timestamps, but I have no idea what it is I am doing wrong...</p>



<a name="159069939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159069939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159069939">(Feb 21 2019 at 14:09)</a>:</h4>
<blockquote>
<p>and the next not-yet-used (as in handed out) timestamp must be stored somewhere</p>
</blockquote>
<p>Ah, so this is stored there after it is handed out and before it is used? I guess what I'm missing is, why not just create a new time stamp when you need it, as in, why does it need to create it before, and store it there, and then fetch it from there?</p>



<a name="159069955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159069955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159069955">(Feb 21 2019 at 14:09)</a>:</h4>
<p>it needs to know which IDs are already used and which aren't?</p>



<a name="159069962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159069962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159069962">(Feb 21 2019 at 14:10)</a>:</h4>
<p>and it should not have to scan <em>all memory</em> for that</p>



<a name="159070022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159070022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159070022">(Feb 21 2019 at 14:10)</a>:</h4>
<p>this is a standard data structure: a thing that, every time you ask it, gives you a new never-before-seen ID</p>



<a name="159070040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159070040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159070040">(Feb 21 2019 at 14:10)</a>:</h4>
<p>I even have the code for that in <a href="https://github.com/RalfJung/unsafe-code-guidelines/blob/stacked-borrows/wip/stacked-borrows.md#generating-timestampts" target="_blank" title="https://github.com/RalfJung/unsafe-code-guidelines/blob/stacked-borrows/wip/stacked-borrows.md#generating-timestampts">https://github.com/RalfJung/unsafe-code-guidelines/blob/stacked-borrows/wip/stacked-borrows.md#generating-timestampts</a></p>



<a name="159070206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159070206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159070206">(Feb 21 2019 at 14:13)</a>:</h4>
<p>ah duh, the clock is the timestamp counter</p>



<a name="159070322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused%20timestamps/near/159070322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/unused.20timestamps.html#159070322">(Feb 21 2019 at 14:14)</a>:</h4>
<p>nvm, I don't know why unused confused me, I probably wasn't seen that part below in the diff</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>